package com.workerhelping.controller;

import com.workerhelping.dto.AssistDTO;
import com.workerhelping.feignClients.MySQLFeignClient;
import com.workerhelping.po.Admin;
import com.workerhelping.result.Result;
import com.workerhelping.result.ResultCodeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/admin")
public class AdminController {

    @Autowired
    private MySQLFeignClient mySQLFeignClient;

    /**
     * 管理员登录
     * @param admin adminVO
     * @return
     */
    @PostMapping("/login")
    Result<Object> adminLogin(@RequestBody Admin admin) {
        Result<Object> isExist = mySQLFeignClient.adminLogin(admin);
        if (!isExist.isOk())
            return Result.build(null, ResultCodeEnum.LOGIN_FAIL);
        return Result.ok();
    }
}
